<template>
	<view class="list">
		<view class="item" v-for="item in list" :key="item.foundId" @click="navigator(item.foundId)">
			<image mode="aspectFill" :src="item.pic ? item.pic : '/static/images/icon/no-pic.png'"></image>
			<view class="right">
				<view class="title">
					<u-tag v-if="item.type == 1" text="招领" mode="dark" type="success"/>
					<u-tag v-if="item.type == 2" text="寻物" mode="dark" type="error"/>
					{{item.title}}
				</view>
				<view class="content">{{item.content}}</view>
				<view class="time">
					<text>{{formatDate(item.createTime)}}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: ['list'],
		methods:{
			navigator (foundId) {
				this.$emit('lostFoundItemClick', foundId)
			},
			formatDate(dataStr) {
				if (dataStr) {
					return dataStr.replace(/-/g,"/").substring(0, 16)
				}
			}
		}
	}
</script>

<style lang="scss">
	@import "./lost-found-list.scss";
</style>
